Attempt at fixing "Fatal error: Call to a member function getText() on a non-object...
authorReedy <reedy@wikimedia.org>
Sat, 28 Apr 2012 00:33:24 +0000 (01:33 +0100)
committerReedy <reedy@wikimedia.org>
Sat, 28 Apr 2012 00:33:24 +0000 (01:33 +0100)
$page->getParserOutput() can apparently return false, so seems a reasonable starting point

Change-Id: I5ee1996f19405d4c854900376a3588fb1b7bbb66

includes/api/ApiParse.php

index 141f779..c2bdeb1 100644 (file)
@@ -328,6 +328,9 @@ class ApiParse extends ApiBase {
                        // Try the parser cache first
                        // getParserOutput will save to Parser cache if able
                        $pout = $page->getParserOutput( $popts );
+                       if ( !$pout ) {
+                               $this->dieUsage( "There is no revision ID {$page->getLatest()}", 'missingrev' );
+                       }
                        if ( $getWikitext ) {
                                $this->text = $page->getRawText();
                        }